package com.um2.mauction.java;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.DynaActionForm;

public class FrmAjoutProduitParticulier3Bean extends DynaActionForm 
{
	private static final long serialVersionUID = 1L;

	public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {

		String transmissionMode = (String) this.get("cmbTransmissionMode");
		String transmitionCost = (String) this.get("txtTransmitionCost");
		ActionErrors errors = new ActionErrors();

		if (transmitionCost == null || transmitionCost.trim().equals("")) 
		{
			errors.add("auctionWantedPriceVide", new ActionMessage(
					"AjoutProduit.particulier.auctionWantedPrice.vide"));
		}/* else if (!transmitionCost.matches("(\\+|-)?(\\d*\\.\\d+|\\d+\\.\\d*)")) {
			errors.add("auctionWantedPriceIncorect", new ActionMessage(
					"AjoutProduit.particulier.price.Incorect"));}*/
		if (transmissionMode == null || transmissionMode.trim().equals("")) 
		{
			errors.add("auctionWantedModeVide", new ActionMessage(
					"AjoutProduit.particulier.auctionWantedMode.vide"));
		}
		return errors;
	}
}